package robotleMvc.frameworks.topMenu
{
	import flash.events.MouseEvent;
	import flash.utils.setTimeout;
	
	import org.robotlegs.mvcs.Mediator;
	
	import robotleMvc.frameworks.buildEdit.event.BuildEditEvent;
	import robotleMvc.frameworks.fire.FireEvent;
	import robotleMvc.frameworks.glass.GlassEvent;
	import robotleMvc.frameworks.lizhi.fensan.FensanEvent;
	import robotleMvc.frameworks.scene3D.event.Scene3DEvent;
	import robotleMvc.frameworks.scene3D.model.Scene3DModel;
	import robotleMvc.frameworks.topMenu.event.TopMenuEvent;
	import robotleMvc.ui.topMenu.TopMenuView;

	// --------------MSN:lation_pan@live.cn  QQ: 3423526------------- //
	public class TopMenuMediator extends Mediator
	{
		[Inject]
		public var topMenuView:TopMenuView;
		[Inject]
		public var scene3DModel:Scene3DModel;
		public function TopMenuMediator()
		{
			super();
		}
		override public function onRegister():void
		{

			addEvents();

		}
		
		private function addEvents():void
		{
			this.addContentViewListener(topMenuView.saveGlassBut, MouseEvent.CLICK,saveGalseeButClik)
			this.addContentViewListener(topMenuView.showTieXiaoBut, MouseEvent.CLICK,showTieXiaoButClik)
			this.addContentViewListener(topMenuView.makeShadowBut, MouseEvent.CLICK,makeShadowButClik)
			this.addContentViewListener(topMenuView.showGroundHightBut, MouseEvent.CLICK,showGroundHightButClik);
			this.addContentViewListener(topMenuView.fireBut, MouseEvent.CLICK,showFireButClik);
			
			
		}
	
		private function saveGalseeButClik(mouseEvent:MouseEvent):void
		{
			scene3DModel.showGlassView=!scene3DModel.showGlassView;
			this.dispatch(new GlassEvent(GlassEvent.UP_NEW_GLASS_INFO_PIC));
			
		
			
		}
		private function showGroundHightButClik(mouseEvent:MouseEvent):void
		{
			this.dispatch(new Scene3DEvent(Scene3DEvent.GET_GROUND_HEIGHT_BITMAPDATA));
			
		}
		private var haveScaningShadow:Boolean=false;
		private function makeShadowButClik(mouseEvent:MouseEvent):void
		{
			if(!haveScaningShadow){
				this.dispatch(new Scene3DEvent(Scene3DEvent.GET_SHODAR_BITMAPDATA));
				haveScaningShadow=false;
			}
			
		}
		private function showTieXiaoButClik(mouseEvent:MouseEvent):void
		{
			this.dispatch(new FensanEvent(FensanEvent.SHOW_FENSAN_XIAOGUO));
			
		}
		private function showFireButClik(mouseEvent:MouseEvent):void
		{
			scene3DModel.showFireView=!scene3DModel.showFireView;
			this.dispatch(new FireEvent(FireEvent.SHOWFIREEEVNET));
			
		    this.dispatch(new BuildEditEvent(BuildEditEvent.OPEN_BUILD_EDIT_VIEW));
			
		}
	
	}
}